package 题目集.线段树or树状数组;

import java.util.Arrays;
import java.util.Scanner;

public class 升序降序后的数组 {
    static Integer[] arr;

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        arr=new Integer[n];
        for (int i = 1; i <= n; i++) {
            arr[i-1]=i;
        }
        for (int i = 0; i < m; i++) {
            int op = sc.nextInt();
            int r = sc.nextInt();
            if (op==1) {
                sx(r);
            }else{
                jx(r);
            }
            int a=0;
        }
        for (Integer i : arr) {
            System.out.print(i+" ");
        }
    }

    public static void sx(int r) {
        Arrays.sort(arr, r-1, arr.length);
    }

    public static void jx(int r) {
        Arrays.sort(arr, 0, r, (a, b) -> b - a);
    }
}
